package com.project.internship.mapper;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.internship.entity.Bases;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.internship.vo.BasesDeptVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author author
 * @since 2020-04-06
 */
@Repository
public interface BasesMapper extends BaseMapper<Bases> {

    /**
     * 根据公司名字查询
     * @param page
     * @param keyword
     * @return
     */
    IPage<BasesDeptVO> getAllBases(Page<BasesDeptVO> page,String keyword);

    /**
     * 学院端查询基地信息
     * @param page
     * @param keyword
     * @return
     */
    IPage<Bases> getAllOwnBases(Page<Bases> page, @Param("departmentId") Integer departmentId, @Param("keyword") String keyword);

    /**
     * 根据基地name得到id
     * @return
     */
    Integer getBaseIdByName(String name);

    List<Bases> getNonAllotBases(@Param("departmentId") Integer departmentId, @Param("currentYear") String currentYear);

    IPage<Bases> getAllotBases(Page<Bases> page,@Param("keyword") String keyword,@Param("departmentId") Integer departmentId, @Param("year") String year);

    List<BasesDeptVO> getBaseSelf(Integer baseId);
}
